<div>
    <form class="form-horizontal bv-form"  role="form"  id="updateForm">
        <fieldset>
            <legend>基本信息</legend>
            <div class="form-group">
                <label class="col-sm-3 control-label">知识库名称</label>
                <div class="col-sm-5">
                    <input type="text"  class="form-control" name="knowledge_name">

                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">类型</label>
                <div class="col-sm-5">
                    <select class="SearchForm form-control knowledge_mold"  name="knowledge_mold"style="width:200px;height:32px;">
                        <option value="1">团队知识库</option>
                        <option value="2">公共知识库</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">咨询类型</label>
                <div class="col-sm-5">
                    <select class="SearchForm form-control knowledge_type" id="knowledge_type" name="knowledge_type" style="width:200px;height:32px;">
                        <option value="1">Banner咨询(360*150)</option>
                        <option value="2">图文资讯(115*85)</option>
                        <option value="3">技术资料(115*85)</option>
                    </select>
                </div>
            </div>
            <div class="form-group" id="file1_file">
                <label class="col-sm-3 control-label">上传图片</label>
                <div class="col-sm-5">
                    <a href="javascript:;" class="file file1">选择文件
                        <input type="file" name="file" id="file1" onchange="aaaa(this);">
                    </a>

                </div>

            </div>
            <div class="form-group" id="androimg_file">
                <label class="col-sm-3 control-label">预览图</label>
                <div class="col-sm-3 file1_1" id="androimg" style="float:left">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">内容</label>
                <div class="col-sm-8">
                    <script id="container" name="knowledge_context" type="text/plain" style="width:500px;height:100%;min-height:400px;">
                    </script>
                </div>
            </div>
        </fieldset>
    </form>

</div>
<script src="static/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script src="static/ueditor/ueditor.all.js"></script>
<script type="text/javascript" charset="utf-8" src="static/ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript">

    $(".knowledge_mold").on('change',function () {
        var project_type = $(this).val();
        $(".knowledge_type").html("");
        var html = '';
        if(project_type==1){
            html ='<option value="1">Banner咨询(360*150)</option><option value="2">图文资讯(115*85)</option><option value="3">技术资料(115*85)</option>';
        }else{
            html ='<option value="2">图文资讯(115*85)</option><option value="3">技术资料(115*85)</option>';
        }
        $(".knowledge_type").append(html);
    })

    $(".knowledge_type").on('change',function () {
        var knowledge_type = $(this).val();
        if(knowledge_type==3){

            $('#file1_file').hide();
            $('#androimg_file').hide();
        }else {
            $('#file1_file').show();
            $('#androimg_file').show();
        }
    })
    function aaaa(file) {
        var prevDiv = document.getElementById('androimg');
        if (file.files && file.files[0])
        {
            var reader = new FileReader();
            reader.onload = function(evt){
                prevDiv.innerHTML = '<img src="' + evt.target.result + '" height="150" width="150"/>';
            }
            reader.readAsDataURL(file.files[0]);
        }
        else
        {
            prevDiv.innerHTML = '<div class="img" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src=\'' + file.value + '\'"></div>';
        }
    }

    var ue = UE.getEditor('container',{
        toolbars: [
            [
                'undo', //撤销
                'redo', //重做
                'bold', //加粗
                'indent', //首行缩进
                'italic', //斜体
                'underline', //下划线
                'strikethrough', //删除线
                'fontborder', //字符边框
                'formatmatch', //格式刷
                'source', //源代码
                'cleardoc', //清空文档
                'simpleupload', //单图上传
                'justifyleft', //居左对齐
                'justifyright', //居右对齐
                'justifycenter', //居中对齐
                'justifyjustify', //两端对齐
            ]
        ]
    });

</script>




